package com.ztt.mapper;

import com.ztt.pojo.entity.zttEmployee;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    @Select("select * from employees where Employee_id = #{employeeID}")
    public zttEmployee getEmployeeById(zttEmployee employee);

    @Select("select * from employees where Employee_name = #{employeeName}")
    public zttEmployee getEmployeeByName(zttEmployee employee);


    @Select("select * from employees")
    public List<zttEmployee> selectAllEmployee();

    @Insert("insert into employees(Employee_id , Employee_name , Employee_password , Employee_level , Employee_phone , Employee_salary , Notes)"
            +"values (#{employeeID}, #{employeeName}, #{employeePassword}, #{employeeLevel}, #{employeePhone}, #{employeeSalary}, #{notes})")
    public void insertEmployee(zttEmployee employee);

    @Update("update employees " +
            "set Employee_name = #{employeeName}, Employee_password = #{employeePassword}, " +
            "Employee_level = #{employeeLevel}, Employee_phone = #{employeePhone}, " +
            "Employee_salary = #{employeeSalary}, Notes = #{notes} " +
            "where Employee_id = #{employeeID}")
    public void updateEmployee(zttEmployee employee);

    @Delete("delete from employees where Employee_id = #{employeeID}")
    public void deleteEmployee(zttEmployee employee);


}
